<template>
  <div id="app">
    <router-view/>
  </div>
</template>

<script>
import { Loading } from 'element-ui';
const loadingInstance = Loading.service({
  lock: true,
  text: '正在努力加载页面..',
  background: 'rgba(255, 255, 255, 0.85)',
});


export default {
  beforeCreate() {
    let  clientWidth = window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth;
    if (clientWidth <= 1280) {
      document.querySelector('body').style.height = `1080px`;
      document.querySelector('body').style.width = `1920px`;
    }
  },
  mounted() {
      this.$axios({
          method: 'get',
          url: '/a/b',
          params: {
              ID: 111,
          }
      });
      this.$axios({
          method: 'post',
          url: '/d/e',
          data: {
              ID: 222,
          }
      })
  },
  computed: {
    spinning() {
      return this.$store.state.spinning;
    },
  },
  watch: {
    spinning(val) {
      if (!val) {
        loadingInstance.close();
      }
    },
  },
}
</script>